import { defineStore } from "pinia";
import { setting } from "~/utils/setting";
export const chatSettingStore = defineStore("chatSettingStore", () => {
  const chatSettings = useMyLocalStorage<FormTemplatesOptions>(
    "chatSettings",
    setting.options,
  );
  const getSetValue = (menuName: FormTemplatesKey) => {
    return (filedName: string) => {
      return chatSettings.value[menuName].template[filedName].value;
    };
  };
  const setSetValue = (
    menuName: FormTemplatesKey,
    filedName: string,
    value: any
  ) => {
    console.log(chatSettings.value);
    return (chatSettings.value[menuName].template[filedName].value = value);
  };
  const nowOption = useMyLocalStorage<FormTemplatesKey>("nowOption", "api");
  return {
    chatSettings,
    nowOption,
    getSetValue,
    setSetValue,
    originSetting: setting.options,
  };
});
